package me.zhengjie.inter.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import me.zhengjie.annotation.Log;
import me.zhengjie.aop.annotation.BisLog;
import me.zhengjie.business.domain.Zhsq;
import me.zhengjie.business.domain.ZhsqHistory;
import me.zhengjie.business.service.ZhsqHistoryService;
import me.zhengjie.business.service.ZhsqService;
import me.zhengjie.business.service.dto.ZhsqHistoryQueryCriteria;
import me.zhengjie.business.service.dto.ZhsqQueryCriteria;
import me.zhengjie.inter.service.MpZhsqPgService;
import me.zhengjie.utils.PageUtil;
import me.zhengjie.utils.SecurityUtils;
import org.springframework.data.domain.Pageable;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;

/**
 * @author gongtuohao
 * @date 2022-07-22
 **/
@RestController
@RequiredArgsConstructor
@Api(tags = "移动端照护申请操作记录")
@RequestMapping("/mp/zhsqHistory")
public class MpZhsqHistoryController {

    private final ZhsqHistoryService zhsqHistoryService;

    @GetMapping("/list")
    @ApiOperation("移动端查询居家照护评估")
    public ResponseEntity<Object> list(ZhsqHistoryQueryCriteria criteria, Pageable pageable) {
        criteria.setUserId(SecurityUtils.getCurrentUserId());
        return new ResponseEntity<>(PageUtil.toMpContent(zhsqHistoryService.queryAll(criteria, pageable)), HttpStatus.OK);
    }


    @GetMapping("/queryList")
    @ApiOperation("移动端查询居家照护评估")
    public ResponseEntity<Object> queryList(ZhsqHistoryQueryCriteria criteria) {
        return new ResponseEntity<>(PageUtil.toMpContent(zhsqHistoryService.queryList(criteria)), HttpStatus.OK);
    }


    @GetMapping("/queryLastData")
    @ApiOperation("移动端查询最后一条驳回原因")
    public ResponseEntity<Object> queryLastData(Long zhsqId) {
        return new ResponseEntity<>(PageUtil.toMpContent(zhsqHistoryService.queryLastData(zhsqId)), HttpStatus.OK);
    }
}
